// Here we avoid loading the header multiple times
#ifndef VKCHECKER_HEADER
#define VKCHECKER_HEADER
// We need the Plasma Applet headers
#include <KIcon>

#include <Plasma/Applet>
#include <Plasma/Svg>

#include "ui_vkcheckerConfig.h"
#include "vkclient.h"

class QSizeF;
class QTimer;

namespace KWallet
{
	class Wallet;
}

// Define our plasma Applet
class VKChecker : public Plasma::Applet
{
	Q_OBJECT
public:
        // Basic Create/Destroy
	VKChecker(QObject *parent, const QVariantList &args);
	~VKChecker();

        // The paintInterface procedure paints the applet to screen
	void paintInterface(QPainter *painter,
		const QStyleOptionGraphicsItem *option,
		const QRect& contentsRect);
	void init();
	
	static const QString walletFolder;
private:
	// configs
	KWallet::Wallet *m_wallet;
	QString m_login;
	QString m_password;
	int m_pollingTime;
	// other
	QTimer *m_pollingTimer;
	VKClient *m_client;
	Ui::VKCheckerConfig configUi;
	
	void startPolling();
	void getWallet(const char* slot);
	bool setFolder(const QString &folder);
public Q_SLOTS:
	void readWallet(bool success);
	void writeWallet(bool success);	
	void createConfigurationInterface(KConfigDialog *parent);
        void configAccepted();
	
	void poll();
};
 
// This is the command that links your applet to the .desktop file
K_EXPORT_PLASMA_APPLET(vkchecker, VKChecker)
#endif
